<div id="journalList">
  <div class="listOptions">
    <span><a href="{$site_url}/?module=journal{if $corp}&corp=1&accountKey={$accountKey}{/if}">Transaction listing</a></span>
    <span><a href="{$site_url}/?module=journal{if $corp}&corp=1&accountKey={$accountKey}{/if}&type=days">Group by day</a></span>
    <span><a href="{$site_url}/feed/journal.php?id={$feedId}{if $corp}&corp={$accountKey}{/if}"><img src="{$site_url}/templates/{$theme}/images/feed_small.png" border="0" align="absmiddle" /> Feed</a></span>
    {if $corp}
    <span>Account: 
      <select id="accountKey" onchange="window.location='{$site_url}/?module=journal&corp=1&accountKey='+this.value">
        {foreach from=$accounts item=acc}
          <option value="{$acc.key}" {if $accountKey == $acc.key}selected="selected"{/if}>{$acc.description}</option>
        {/foreach}
      </select>
    </span>
    {/if}
  </div>

  {if $pageCount > 0}
  <div align="right">
    {if $prevPage < $pageNum}
      <button onclick="window.location='{$site_url}/?module=journal{if $corp}&corp=1&accountKey={$accountKey}{/if}&p={$prevPage}'" class="pageNav"> &lt;&lt; </button>
    {/if}
    &nbsp; pg {$pageNum+1} / {$pageCount} &nbsp;
    {if $nextPage < $pageCount}
      <button onclick="window.location='{$site_url}/?module=journal{if $corp}&corp=1&accountKey={$accountKey}{/if}&p={$nextPage}'" class="pageNav"> &gt;&gt; </button>
    {/if}
  </div>
  {/if}

  <table width="100%" border="0">
    <tr>
      <th>Time</th>
      <th>Type</th>
      <th>Paid By</th>
      <th>Paid To</th>
      <th>Expense</th>
      <th>Income</th>
      <th>Balance</th>
    </tr>
    {foreach from=$journal item=j}
      <tr class="{cycle values='row,rowAlt'}">
        <td>{$j.date|date_format:"%d/%m/%Y %H:%M"}</td>
        <td>{$j.refType}</td>
        <td>{$j.fromName}</td>
        <td>{$j.toName}</td>
        <td align="right" class="moneyOut">{if $j.amount < 0}{$j.amount|eveNum}{/if}</td>
        <td align="right" class="moneyIn">{if $j.amount > 0}{$j.amount|eveNum}{/if}</td>
        <td align="right">{$j.balance|eveNum}</td>
      </tr>
    {/foreach}
  </table>

  {if !$journal}
    <h3>No journal entries found!</h3>
  {/if}

</div>